<!doctype html>
<head>
    <meta charset="UTF-8">
    <title>修改漫画信息</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css">
    <style>
        .img-thumbnail
        {
            width:200px;
            height:200px;
        }
    </style>
</head>
<body>
<?php
if(empty($_GET["id"]))
{
    die("缺少id参数");
}
$id=$_GET["id"];
$sql="select * from production where id=$id";
include dirname(__FILE__) .'../../common/conn.php';
$res=mysqli_query($con,$sql);
mysqli_close($con);
if(!$res)
{
    die("查询错误");
}
$row = mysqli_fetch_array($res,1);
if(!$row){
    die("查无此信息，<a href='../cartoonList.php'>请重新选择</a>");
}
//     var_dump($row);
?>
<div class="container">
    <div class="page-header">修改漫画信息</div>

    <form action="/back/cartoon/saveEdit.php" class="form-horizontal" method="post" enctype="multipart/form-data">

        <!--作品ID-->
        <div class="form-group">
            <label for="cid" class="col-sm-2 control-label">作品ID</label>
            <div class="col-sm-10">
                <input type="text" class="form-control"  name="cid" value="<?php echo $row['id']  ?>" readonly="true"  />
            </div>
        </div>


        <!--漫画作品名称-->
        <div class="form-group">
            <label for="cname" class="col-sm-2 control-label">漫画名称</label>
            <div class="col-sm-10">
                <input type="text" class="form-control"  name="cname" id="cname"  value="<?php echo $row['name']  ?>" placeholder="请输入漫画名称">
            </div>
        </div>

        <!--        漫画作品类型-->
        <div class="form-group">
            <label for="ctype" class="col-sm-2 control-label">漫画类型</label>
            <div class="col-sm-10">
                <select class="form-control" name="type_id" id="ctype">

                    <?php
                    include dirname(__FILE__) .'../../common/conn.php';
                    $tid= $row["typeId"];
                    $sql1="select * from type";
                    $res1=mysqli_query($con,$sql1);
                    mysqli_close($con);

                    while($row1=mysqli_fetch_array($res1)) {
                        if($tid==$row1["id"]) {
                            ?>
                            <option value="<?php echo $row1["id"] ?>"
                                    selected="<?php echo 'selected'; ?>"><?php echo $row1["name"] ?></option>
                            <?php
                        }
                        else{
                            ?>
                            <option value="<?php echo $row1["id"] ?>"><?php echo $row1["name"] ?></option>
                            <?php
                        }
                    }
                    ?>

                </select>
            </div>
        </div>

        <!--漫画封面-->
        <div class="form-group">
            <label  class="col-sm-2 control-label">漫画封面</label>

            <div class="col-sm-10">
                <img class="img-thumbnail" src="<?php echo $row["coverPic"]?>">
            <p>
                <input type="file" class="form-control" name="coverImg" value="<?php echo $row['coverPic']  ?>">
            </p>

            </div>
        </div>

        <!--漫画作者-->
        <div class="form-group">
            <label for="cauthor" class="col-sm-2 control-label">漫画作者</label>
            <div class="col-sm-10">
                <input type="text" class="form-control"  name="cauthor"
                       value="<?php echo $row['author']  ?>"id="cauthor" placeholder="请输入漫画作者">
            </div>
        </div>

        <!--漫画简介-->
        <div class="form-group">
            <label for="cintroduction" class="col-sm-2 control-label">作品简介</label>
            <div class="col-sm-10">
                <textarea class="form-control" name="cintroduction" id="cintroduction" placeholder="请输入作品简介" rows="5"><?php echo $row["introduction"] ?></textarea>
            </div>
        </div>




        <!--漫画状态-->
        <div class="form-group">
            <label for="cstate" class="col-sm-2 control-label">漫画状态</label>
            <div class="col-sm-10">
                <select class="form-control" name="cstate" id="cstate">
                    <?php
                    if($row["state"]=="连载") {
                        ?>
                        <option value="连载" selected="selected">连载</option>
                        <option value="完结">完结</option>
                        <?php
                    }
                    else {
                        ?>
                        <option value="连载" >连载</option>
                        <option value="完结" selected="selected" >完结</option>
                        <?php
                    }
                    ?>

                </select>
            </div>
        </div>




        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-info">保存</button>
                <a href="list.php" class="btn btn-warning">返回</a>
            </div>
        </div>
    </form>
</div>
</body>
</html>